/*
Copyright 2010-2011 CumulusCloud
http://cumuluscloud.cc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package cumulusCloud.common;

import cumulusCloud.knowledge.ServerKnow;


/**
 * This class gives the information about how to communicate with that server
 * 
 * @author Simon Levesque
 *
 */
public class InformationServer {
	static private ServerKnow know = ServerKnow.getInstance();
	
	/**
	 * To retrieve the current IP that the people on Internet needs to connect to.
	 * 
	 * It will get the IP from a distant server and compare it to the interface IP.
	 * If they are the same, then the interface IP will always be used.
	 * If they are different, then the IP will come from the distant server.
	 * 
	 * NOTE: The IP is cached 10 minutes to avoid excess traffic
	 * 
	 * @return The current IP of the machine on Internet
	 */
	static public String getInternetIP() {
		return know.getInternetIP();
	}
	
	/**
	 * To get the most secure URL to connect on this machine.
	 * 
	 * If the https is set, then it will gives https://HOST:PORT/
	 * If not set, then the http
	 * 
	 * @return The most secure URL
	 */
	static public String getInternetBaseURL() {
		return know.getInternetBaseURL();
	}
	
	/**
	 * To get the http URL to connect on this machine.
	 * 
	 * The format is http://HOST:PORT/
	 * 
	 * @return The http URL
	 */
	static public String getInternetNonSecureBaseURL() {
		return know.getInternetNonSecureBaseURL();
	}
	
	/**
	 * To get the https URL to connect on this machine.
	 * 
	 * The format is https://HOST:PORT/
	 * 
	 * @return The https URL
	 */
	static public String getInternetSecureBaseURL() {
		return know.getInternetSecureBaseURL();
	}
}
